package io;

import com.sun.media.jfxmediaimpl.HostUtils;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
        //创建一个文件输入流，用来从原文件中读取每个字节
        FileInputStream fis = new FileInputStream("./demo.txt");
        //创建一个文件输出流，用来向复制的文件中写入每个字节
        FileOutputStream fos = new FileOutputStream("./demo1.txt");
        int d = 0;
        while ( (d = fis.read()) != -1){
            fos.write(d);
        }
        System.out.println("复制完毕");
        fis.close();
        fos.close();
    }
}
